// POJ 3349
#include <iostream>
#include <algorithm>
#include <vector>
#include <cmath>
#include <queue>
#include <functional>
#include <cstdio>
#include <cassert>
#include <list>
#include <map>
#include <string>
#include <ctime>
using namespace std;

struct Snow
{
	int leaf[6];
	bool operator==(const Snow &other) const
	{
		if (hf() == other.hf())
		{
			for (int i = 0; i < 6; i++)
			{
				int j = 0;
				for (; j < 6; j++)
				{
					if (leaf[j] != other.leaf[(i + j) % 6])
						break;
				}
				if (j == 6)
					return true;
			}
			for (int i = 0; i < 6; i++)
			{
				int j = 0;
				for (; j < 6; j++)
				{
					if (leaf[j] != other.leaf[(i - j + 6) % 6])
						break;
				}
				if (j == 6)
					return true;
			}
			return false;
		}
		return false;
	}
	unsigned int hf() const
	{
		unsigned int ans = 0;
		for (int i = 0; i < 6; i++)
		{
			ans += leaf[i];
		}
		return ans;
	}
};

template <typename T>
struct HashFcn
{
};

template <>
struct HashFcn<Snow>
{
	unsigned int operator()(const Snow &key)
	{
		return key.hf();
	}
};

/* Prime numbers
			   61,       83,      113,      151,      211,      281,      379,      509,
			  683,      911,     1217,     1627,     2179,     2909,     3881,     5179,
			 6907,     9209,    12281,    16381,    21841,    29123,    38833,    51787,
			69061,    92083,   122777,   163729,   218357,   291143,   388211,   517619,
		   690163,   920219, 1226959, 1635947, 2181271, 2908361, 3877817, 5170427,
		6893911, 9191891, 12255871, 16341163, 21788233, 29050993, 38734667, 51646229,
		68861641, 91815541,122420729,163227661,217636919,290182597,386910137,515880193,
		687840301,917120411,1222827239,1610612741
*/

// only search and insert, no remove
template<typename T, typename HashFun, unsigned int MaxEleCnt, unsigned int BucketSize>
class HashSet
{
	struct Node
	{
		Node(){}
		Node(const T &k): key(k) {}
		T key;
		// 0 is null
		unsigned int next;
	};
public:
	HashSet()
	{
		clear();
	}
	unsigned int size()
	{
		return BucketSize;
	}
	void clear()
	{
		pos = 1;
		memset(bucket, 0, sizeof(bucket));
	}

	// if key exists then return false
	bool insert(const T &key)
	{
		if (contain(key) == false)
		{
			unsigned int idx = getIndex(key);
			Node nd(key);
			nd.next = bucket[idx];
			all[pos] = nd;
			bucket[idx] = pos;
			pos++;
			return true;
		}
		return false;
	}
	bool contain(const T &key)
	{
		unsigned int idx = getIndex(key);
		int i = bucket[idx];
		if (i == NULL)
			return false;
		else
		{
			while (i)
			{
				if (all[i].key == key)
					return true;
				i = all[i].next;
			}
			return false;
		}
	}
private:
	unsigned int getIndex(const T &key)
	{
		return fun(key) % BucketSize;
	}
private:
	HashFun fun;
	Node all[MaxEleCnt + 1];
	unsigned int pos;
	unsigned int bucket[BucketSize];
};

HashSet<Snow, HashFcn<Snow>, 100000, 92083> mp;

int main()
{
	int n;
	scanf("%d", &n);
	bool found = false;
	for (int i = 0; i < n; i++)
	{
		Snow sn;
		for (int i = 0; i < 6; i++)
		{
			scanf("%d", &sn.leaf[i]);
		}
		if (!found)
		{
			if (mp.insert(sn) == false)
			{
				found = true;
			}
		}
	}
	if (found)
		printf("Twin snowflakes found.");
	else
		printf("No two snowflakes are alike.");
	system("pause");
	return 0;
}